/*
 * @Timur Suleimanov, Kiev 2012
 * Calendar Seeker
 * Implements a program that prints out the day of the week for a given day
 */
import java.util.Scanner;

public class CalendarSeeker {
	
	public static int monthSelector(int month, int year){
		int dayOfTheWeek = 0;
		if (year % 4 == 0 && month <= 2) {
            dayOfTheWeek--;
        }
		switch (month) {
            case 12:
                return dayOfTheWeek += 30;
            case 11:
                return dayOfTheWeek += 31;
            case 10:
                return dayOfTheWeek += 30;
            case 9:
                return dayOfTheWeek += 31;
            case 8:
                return dayOfTheWeek += 31;
            case 7:
                return dayOfTheWeek += 30;
            case 6:
                return dayOfTheWeek += 31;
            case 5:
                return dayOfTheWeek += 30;
            case 4:
                return dayOfTheWeek += 31;
            case 3:
                return dayOfTheWeek += 28;
            case 2:
                return dayOfTheWeek += 31;
        }
		return dayOfTheWeek;
	}
	
	public static void dayDisplay(int dayOfTheWeek) {
		switch (dayOfTheWeek) {
            case 0:
                System.out.println("It's Sunday");
                break;
            case 1:
                System.out.println("It's Monday");
                break;
            case 2:
                System.out.println("It's Tuesday");
                break;
            case 3:
                System.out.println("It's Wednesday");
                break;
            case 4:
                System.out.println("It's Thursday");
                break;
            case 5:
                System.out.println("It's Friday");
                break;
            case 6:
                System.out.println("It's Saturday");
                break;
        }
	}

    public static void findDayOfTheWeek(int day, int month, int year) {
        int dayOfTheWeek = (year - 1900) * 365 + (year - 1900) / 4;
        dayOfTheWeek = monthSelector(month, year);
        dayOfTheWeek = (day + dayOfTheWeek) % 7;
		dayDisplay(dayOfTheWeek);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Please input date");
        int day = in.nextInt();
        int month = in.nextInt();
        int year = in.nextInt();
        if ((day < 1 || day > 31) || (month < 1 || month > 12) 
		|| (year < 1900)) {
			System.out.println("Wrong data");  
        } else {
            findDayOfTheWeek(day, month, year);
        }
    }
}
